<?php
declare(strict_types=1);
namespace App\Controller\Api\V1\User;

use App\Controller\Api\BaseController;
use App\Helper\Utils;
use App\Model\WechatQrcode;
use App\Repositories\SysConfigRepository;
use App\Services\MiniProgramService;
use Hyperf\DbConnection\Db;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Utils\Str;

class UserController extends BaseController
{
    /**
     * @Inject
     * @var MiniProgramService
     */
    private $mini_service;
    public function account(){
        $user= $this->request->getAttribute('user');
        $account = $user->account;
        return $this->response->success($account);
    }

    public function home(){
        $user= $this->request->getAttribute('user');
        return $this->response->success($user);
    }

    public function checkSupervisor(){
        $user= $this->request->getAttribute('user');
        $is_test = SysConfigRepository::getInstance()->get(['IS_APP_TEST']);
        if(isset($is_test['IS_APP_TEST'])&&$is_test['IS_APP_TEST']){
            $is_supervisor=1;
        }else{
            $is_supervisor = $user->is_supervisor;
        }
        return $this->response->success([
            'is_supervisor' => $is_supervisor
        ]);
    }
}